$(function(){
   if (localStorage.getItem('bag')) {
    var bag=JSON.parse(localStorage.getItem('bag'));
    var bag_len=bag.length;

      $('#bag_len').text(bag_len.toString());


  }
    else {
      var bag = new Array();

      localStorage.setItem('bag',JSON.stringify(bag));
    }
});

function shuffle(a) {
    var j, x, i;
    for (i = a.length - 1; i > 0; i--) {
        j = Math.floor(Math.random() * (i + 1));
        x = a[i];
        a[i] = a[j];
        a[j] = x;
    }
    return a;
};






